import request from '@/utils/request'

// 查询事项列表
export function listService(query) {
  return request({
    url: '/items/service/list',
    method: 'get',
    params: query
  })
}

//  新接口 查询未关联的事项
export function unrelatedMatters(data) {
  return request({
    url: '/items/service/getRelevanceItem',
    method: 'post',
    data
  })
}

// 查询事项详细
export function getService(id) {
  return request({
    url: '/items/service/' + id,
    method: 'get'
  })
}

// 新增事项
export function addService(data) {
  return request({
    url: '/items/service',
    method: 'post',
    data: data
  })
}

// 修改事项
export function updateService(data) {
  return request({
    url: '/items/service',
    method: 'put',
    data: data
  })
}

// 删除事项
export function delService(id) {
  return request({
    url: '/items/service/' + id,
    method: 'delete'
  })
}

// 获取事项系统事项
export function listAssociateService(query) {
    return request({
      url: '/items/service/getRelevanceItem',
      method: 'get',
      params: query
    })
}


// 新增关联事项系统事项
export function batchOutsideServices(data) {
  return request({
    url: '/items/service/batchOutsideServices',
    method: 'post',
    data: data
  })
}

// 关联全省通办事项
export function correlationAll(data) {
  return request({
    url: '/provinces/batchOutsideServices',
    method: 'post',
    data: data
  })
}

// 查询已关联事项
export function alreadyCorrelation(data) {
  return request({
    url: '/provinces/listProvince',
    method: 'post',
    data: data
  })
}

// 删除已关联事项
export function deleteAlready(id) {
  return request({
    url: '/provinces/' + id,
    method: 'delete',
  })
}


//关联或取消关联事项
// export function associatedOrNot (data) {
//   return request({
//     url: '/items/service/relService',
//     method: 'post',
//     data
//   })
// }

// 增加网点关联事项
export function addServiceBranchRelation(data) {
  return request({
    url: '/items/service/addServiceBranchRelation',
    method: 'post',
    data
  })
}

// 删除网点关联事项
export function deleteServiceBranchRelation(data) {
  return request({
    url: '/items/service/deleteServiceBranchRelation',
    method: 'post',
    data
  })
}
// 查询可关联当前网点事项列表
export function listServiceNotInBranch(query) {
  return request({
    url: '/items/service/listServiceNotInBranch',
    method: 'get',
    params: query
  })
}
// 查询当前网点包含的事项
export function listServiceInBranch(query) {
  return request({
    url: '/items/service/listServiceInBranch',
    method: 'get',
    params: query
  })
}
